package com.server.pinggu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.server.pinggu.mapper.SenCountUsersIpMapper;
import com.server.pinggu.domain.SenCountUsersIp;
import com.server.pinggu.service.ISenCountUsersIpService;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ltao
 * @date 2022-10-23
 */
@Service
public class SenCountUsersIpServiceImpl extends ServiceImpl<SenCountUsersIpMapper, SenCountUsersIp> implements ISenCountUsersIpService {

    @Override
    public List<SenCountUsersIp> queryList(SenCountUsersIp senCountUsersIp) {
        LambdaQueryWrapper<SenCountUsersIp> lqw = Wrappers.lambdaQuery();
        if (senCountUsersIp.getIp() != null){
            lqw.eq(SenCountUsersIp::getIp ,senCountUsersIp.getIp());
        }
        if (senCountUsersIp.getLastdate() != null){
            lqw.eq(SenCountUsersIp::getLastdate ,senCountUsersIp.getLastdate());
        }
        if (StringUtils.isNotBlank(senCountUsersIp.getCount())){
            lqw.eq(SenCountUsersIp::getCount ,senCountUsersIp.getCount());
        }
        if (senCountUsersIp.getTotal() != null){
            lqw.eq(SenCountUsersIp::getTotal ,senCountUsersIp.getTotal());
        }
        if (senCountUsersIp.getAllTotal() != null){
            lqw.eq(SenCountUsersIp::getAllTotal ,senCountUsersIp.getAllTotal());
        }
        return this.list(lqw);
    }
}